package com.steak.stock.adapter;

import com.steak.common.domain.dataobject.tcc.Stock;
import com.steak.common.result.Response;
import com.steak.stock.execute.StockExecute;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘牌
 * @Title:
 * @date 2022/3/116:37
 */
@RestController
@AllArgsConstructor
@RequestMapping("/stock")
public class StockController {


    private final StockExecute stockExecute;

    @RequestMapping("/decreaseStock")
    public Response decreaseStock(@RequestBody Stock stock) throws InterruptedException {
        return stockExecute.execute(stock);
    }

    public Response get(){
        return stockExecute.get();
    }
}
